﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ModuleDuoc
{
    public class Utils
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="v"></param>
        /// <returns></returns>
        public static string formatVNCur(double v)
        {
            if (v % 1 != 0)
            {
                return String.Format("{0:#,##0.000}", v);
            }
            return String.Format("{0:#,##}", v);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="v"></param>
        /// <param name="check"></param>
        /// <returns></returns>
        public static string formatVNCur(double v, bool check)
        {
            if (check == true)
            {
                if (v % 1 != 0)
                {
                    return String.Format("{0:#,##0.000}", v);
                }
                return String.Format("{0:#,##}", v);
            }
            else
            {
                return String.Format("{0:#,##}", v);
            }
        }
    }
}
